package Test02;

import java.util.ArrayList;
import java.util.Objects;

public class Test2 {
    public static void main(String[] args) {
        ArrayList<Student> students = new ArrayList<>();
        students.add(new Student(1, "张无忌", "河北"));
        students.add(new Student(2, "张三丰", "河南"));
        students.add(new Student(3, "赵敏", "蒙古"));
        students.add(new Student(4, "周芷若", "四川"));

        for (Student student : students) {
            if (Objects.equals(student, "张三丰")) {
                student.setAddress("山东");
            }
        }
        for (int i = 0; i < students.size(); i++) {
            System.out.println("学生学号为:" + students.get(i).getID() + ",姓名为:" + students.get(i).getName() + ",住址为:" + students.get(i).getAddress());
        }
    }
}
